<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //95.64%
    var addStrings = function(num1, num2) {
        if(num1 == '0' && num2 == '0')return '0';
        let len1 = num1.length, len2 = num2.length;
        if(len1 < len2){
            num1 = '0'.repeat(len2-len1) + num1;
        }else{
            num2 = '0'.repeat(len1-len2) + num2;
        }
        num1 = '0' + num1;
        num2 = '0' + num2;
        let len = num1.length;
        let sum = '';
        let flag = 0, a;
        for(let i=len-1; i>=0; i--){
            if(flag == 0){
                a = parseInt(num1[i]) + parseInt(num2[i]);
            }else{
                a = parseInt(num1[i]) + parseInt(num2[i]) + 1;
            }
            if(a < 10){
                sum += a;
                flag = 0;
            }else{
                sum += (a - 10);
                flag = 1;
            }
        }
        sum = sum.split('').reverse().join('');
        if(sum[0] == '0')sum = sum.slice(1);
        return sum;
    };
    let num1 = '408', num2 = '5';
    console.log(addStrings(num1, num2));
    
</script>
</html>